#ifndef _UTILEX_STRING_HPP_
#define _UTILEX_STRING_HPP_

#include <crt_util.h>

#ifdef __cplusplus

struct ChartoUcs2Struct {
    static void* default_value() { return 0; }
    template <class _Ptr> static bool equal_to(_Ptr l, _Ptr r) { return l == r; }
    template <class _Ptr> static void destroy(_Ptr p)
    {
        if (p != NULL) {
            heap_free(p);
        }
    }
};

static_inline int BasicString_Append_Char(basestring& src, const char* dst, size_t len)
{
#if (TARGET_OS == OS_WIN)
    {
        SafePtr<basic_tchar*, ChartoUcs2Struct> pBuf;
        pBuf = char_to_wchar(dst, len);
        src += pBuf;
    }
#elif (TARGET_OS == OS_POSIX)
    src += dst;
#elif (TARGET_OS == OS_MACH)
    src += dst;
#endif

    return S_SUCCESS;
}

#endif

#endif
